package com.caijb.redisdemo.controller;

import com.caijb.redisdemo.dto.Person;
import com.caijb.redisdemo.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author caijb
 * @version 1.0
 * @data 2025/11/1 18:39
 */

@RestController
public class RedisController {

    @Autowired
    private RedisUtil redisUtil;


    @GetMapping("/test")
    public boolean test() {
        Person person = new Person();
        person.setName("caijb");
        person.setAge(18);
        redisUtil.setHash("test", "test", person);
        redisUtil.setHash("test", "test2", person);
        Map<Object, Object> test = redisUtil.getHashAll("test");
        System.out.println(test);
        return true;
    }
}
